<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>

<body>
<?php
/* 新闻类别删除处理页 */
require_once("../../conn/conn_db.php");   //包含数据库连接文件
if( $_GET["nt_id"]!= "")
{
    $ntid = $_GET["nt_id"];     //获取传递的新闻类别编号
    $sql = "select * from news_type where nt_parentid=".$ntid;  //查询语句
    $arr = $conn->query($sql);   //执行SQL语句
    if ($result->num_rows > 0)  //判断查询结果行数，判断是否含有子类别
    {
        echo "<script>alert('该类别有子类别，请先删除子类别！');self.location='../newstype_manager.php'</script>";
    }
    else
    {
        $sql = "delete from news_type where nt_id=".$ntid;  //删除语句
        $delete = $conn->query($sql); //执行SQL语句
        if($delete)                  //判断执行结果
        {
            echo "<script>alert('新闻类别删除成功！');self.location='../newstype_manager.php'</script>";
        }
        else
        {
            echo "<script>alert('新闻类别删除失败！');self.location='../newstype_manager.php'</script>";
        }
    }
}
else
{
    echo "<script>alert('请选择要删除的新闻类别！');self.location='../newstype_manager.php'</script>";
}
?>
</body>
</html>